#ifndef REFRESHTIMER_H
#define REFRESHTIMER_H

#include <QThread>
#include <QList>
#include "free-cube/airefresher.h"

class RefreshTimer : public QThread, public fc::AIRefresher
{
    Q_OBJECT
public:
    explicit RefreshTimer(int msec = 50, QObject *parent = 0);
    ~RefreshTimer(){this->unsubmit_all();}
    void run();
    void submit(fc::AIRefreshee * refreshee);
    void unsubmit(fc::AIRefreshee * refreshee);
    void refresh_all();
    void start_timer();
    void stop_timer();
    void unsubmit_all();
signals:
    //void refresh_event(int msec_elapsed);
public slots:
private:
    bool is_started_;
    int msec_;
    QList <fc::AIRefreshee *> submitters_;
};

#endif // REFRESHTIMER_H
